home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 3.6 KB | 133 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: GrfxRun.h
- // Release Version: $ 1.0d1 $
- //
- // Author: Anthone Burbidge
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef _GRFXRUN_
- #define _GRFXRUN_
-
- #ifndef _QDFIX_
- #include <QDFix.h>
- #endif
-
- // ----- Textension Includes -----
-
- #ifndef _ToolBoxDump_
- #include "ToolBoxDump.h"
- #endif
-
- #ifndef _TextensionCommon_
- #include "TextensionCommon.h"
- #endif
-
- #ifndef _RunObject_
- #include "RunObject.h"
- #endif
-
- //========================================================================================
- // CLASS CBetterGraphicsRun
- //========================================================================================
-
- class CBetterGraphicsRun : public CRunObject
- {
- //------------------------------------------------------------------------------
- // • Constants
- //
- public:
- enum { kDefaultSelectionWidth = 2,
- kDefaultHite = 16,
- kDefaultWidth = 16 };
-
- //------------------------------------------------------------------------------
- // • Initialization/Destruction
- //
- public:
- CBetterGraphicsRun();
- virtual ~CBetterGraphicsRun();
- void InitBetterGraphicsRun(short selectionWidth = kDefaultSelectionWidth);
-
- //------------------------------------------------------------------------------
- // • Inherited API
- //
- virtual CAttrObject* CreateNew() const = 0;
-
- virtual ClassId GetClassId() const = 0;
-
- Boolean IsTextRun() const;
-
- virtual TObjFlags GetObjFlags();
-
- //DoPixel2Char and DoChar2Pixel will never be called since kIndivisibleRun is returned, but they are pure virtual fns
- virtual void DoPixel2Char(Pixel2CharPb* paramPb);
- virtual short DoChar2Pixel(Char2PixelPb* paramPb);
-
- virtual Fixed DoMeasure(MeasurePb* paramPb);
- virtual StyledLineBreakCode DoBreak(LineBreakPb* paramPb);
- virtual void DoDrawJust(DrawJustPb* paramPb);
-
- virtual void SetHilite(char oldHilite, char newHilite, const RunPositionPB* paramPb, Boolean doDraw = true);
- //paramPb is defined <==> doDraw == true
-
- virtual void DrawSelection(char hiliteStat, const RunPositionPB* paramPb);
-
- virtual void SetCursor(Point, const RunPositionPB*) const; //set it to arrow
-
- protected:
- virtual void CalcHiteInfo(short* ascent, short* descent, short* leading);
-
- //------------------------------------------------------------------------------
- // • New API
- //
- public:
- short GetSelectionWidth() const;
- virtual void SetSelectionWidth(short width);
-
- protected:
- virtual Boolean GetDimensions(short* hite, short* width) = 0;
- //returns the non scaled dimensions
-
- #ifdef txtnScal
- void GetScaledDimensions(short* hite, short* width,
- const Point* numer=nil, const Point* denom=nil);
- #else
- void GetScaledDimensions(short* hite, short* width);
- #endif
-
- virtual void Draw(const Rect* theRect) = 0;
-
- void GetObjectRect(const RunPositionPB* paramPb, Rect* objRect);
-
- private:
- #ifdef txtnScal
- void AdjustObjRect(Rect* objRect, Point numer, Point denom);
- #else
- void AdjustObjRect(Rect* objRect);
- #endif
-
- //------------------------------------------------------------------------------
- // • Data Members
- //
- private:
- short fExtraWidth;
- short fSelectionWidth;
-
- };
-
- //----------------------------------------------------------------------------------------
- // CBetterGraphicsRun::GetSelectionWidth
- //----------------------------------------------------------------------------------------
-
- inline short CBetterGraphicsRun::GetSelectionWidth() const
- {
- return fSelectionWidth;
- }
-
- #endif
-